package com.bw.controller;

import com.bw.bean.Goods;
import com.bw.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class GoodsController {
    @Autowired
    GoodsService goodsService;

    @RequestMapping("/list1")
    public List t1(){
        List<Goods> list1 = goodsService.getList1();
        return list1;
    }

    @RequestMapping("/list2")
    public List t2(){
        List<Goods> list2 = goodsService.getList2("片");
        return list2;
    }

    @RequestMapping("/list3")
    public List t3(){
        List<Goods> list3 = goodsService.getList3(4.5);
        return list3;
    }

    @RequestMapping("/list4")
    public List t4(){
        List<Goods> list4 = goodsService.getList4("2024-05-01", "2024-06-01");
        return list4;
    }

    @RequestMapping("/del")
    public int t5(){
        int i = goodsService.delete(7);
        return i;
    }

    @RequestMapping("/ins")
    public int t6(){
        int i = goodsService.insert("香满缘独家食品大礼包", 200, 99.9, "2024-6-18", 3);
        return i;
    }

    @RequestMapping("/upd")
    public int t7(){
        int i = goodsService.update();
        return i;
    }
}
